package cn.herlioner.service;

import java.util.ArrayList;
import java.util.List;

import com.opensymphony.xwork2.ActionContext;

import cn.herlioner.dao.Obj_StuDAO;
import cn.herlioner.dao.impl.Obj_StuDAOImpl;
import cn.herlioner.pojo.CRUObject;
import cn.herlioner.pojo.Obj_Stu;

public class Obj_StuServiceImpl implements Obj_StuService{

	@Override
	public List<CRUObject> getoneof(List<Obj_Stu> obj_Stus,
			List<CRUObject> cruObjects) {
		
		//加入分页查询
		// ===========分页用的参数============  
		int pageNum = 1;// 当前�? 
		int pageSize = 10;// 每页显示多少条记�? 
		//这里省略了get,set方法  
		// 准备分页信息（将pageBean放在栈顶�? 
		Obj_StuDAOImpl obj_StuDAOImpl = new Obj_StuDAOImpl();
		PageService pageBean = (PageService) obj_StuDAOImpl.getByPaging(pageNum, pageSize);  
		ActionContext.getContext().getValueStack().push(pageBean);
		
		
		List<CRUObject> cruObjects2 = new ArrayList<CRUObject>();
		//循环obj_Stus得到它的objnum�?
		for (Obj_Stu obj_Stu : obj_Stus) {
			Long objnum = obj_Stu.getObjnum();
			System.out.println(obj_Stu.toString());
			for (CRUObject cruObject : cruObjects) {
				Long cruobjnum = cruObject.getObjnum();
				if(objnum==cruobjnum){
					cruObjects2.add(cruObject);
				}
			}
		}
		//循环�?��的cruObjects的objnum值与上面的objnum相比较，相同就将cruObject插入返回列表
		return cruObjects2;
	}

}
